
class SharedListerenJob {
    def timeout = 1000l * 60 * 5//0 // execute job once in 5 seconds

    def execute() {
        // execute task
//        println "SharedListerenJob start : ${new Date().format('MM/dd hh:mm:ss')}"
        def c= new GregorianCalendar()
        c.set(Calendar.MINUTE,-10)
//        log.info "查询时间：${c.time.format('MM/dd hh:mm:ss')}"
        def articles = Article.findAllByOwnerIsNotNullAndLastTimeLessThan(c.time)
        articles.each{
            log.info "unlock article : ${it}"
            it.owner = null
            it.save()
        }

       articles.clear()

    }
}
